package com.ygqh.baby.service;

import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.ResultSet;
import com.ygqh.baby.model.DrawPrize;
import com.ygqh.baby.model.FriendsRankings;
import com.ygqh.baby.model.PrizeItem;
import com.ygqh.baby.po.YgDrawPrize;
import com.ygqh.baby.po.YgUser;

import java.util.List;

public interface YgDrawPrizeService {

    List<YgDrawPrize> find();

    int findCount();

    YgDrawPrize findById(Long id);

    int deleteSoft(Long[] ids);

    int deleteSoft(Long id);

    int save(YgDrawPrize ygDrawPrize);

    int update(YgDrawPrize ygDrawPrize);

    int saveOrUpdate(YgDrawPrize ygDrawPrize);

    ResultSet<YgDrawPrize> search(QueryInfo queryInfo, String q);

    PrizeItem drawPrize(DrawPrize drawPrize, YgUser user);

    int findLastCountByUserId(Long userId, String sourceCode);

    YgDrawPrize findByUserId(Long userId, String sourceCode);

    int addCountByHelp(int count, String sourceCode, Long userId, String openId);

    PrizeItem drawPrizeByRate(DrawPrize drawPrize, YgUser user);

    List<FriendsRankings> getFriendsRankings(Long userId, String openId, String source);

    /**
     * 抽奖结果
     *
     * @param drawPrize 活动信息
     * @param user      抽奖用户
     * @param platformNo      平台编号
     * @return
     */
    PrizeItem drawPrizeV3(DrawPrize drawPrize, YgUser user, String platformNo);

    /**
     * 初始化用户抽奖信息
     *
     * @param sourceCode 活动标识
     * @param userId     用户id
     * @param initCount  初始化次数
     * @param helpCount  助理一次获赠次数
     * @return
     */
    YgDrawPrize initDrawPrize(String sourceCode, Long userId, int initCount, int helpCount);

    int updateCountById(Integer count, Long id);

    List<YgDrawPrize> findList(String sourceCode);
}
